package com.yu.boot2.controller;

import com.yu.boot2.domain.Result;
import com.yu.boot2.rabbit.RabbitSender;
import com.yu.boot2.rocket.SenderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zy
 * @date 2019-01-18 14:17
 **/
@Slf4j
@RestController
@RequestMapping("/test")
public class TestController {

    @Autowired
    private RabbitSender rabbitSender;

    @Autowired
    private SenderService senderService;

    @GetMapping("/rabbit")
    public Result testRabbit(){
        log.info("测试rabbitmq");
        rabbitSender.send("topicExchange","key.2","test-rabbit");
        return Result.ok();
    }

    @GetMapping("/rocket")
    public Result testRocket() throws Exception{
        log.info("测试rocket");
        senderService.send("123","test-rocket");
        return Result.ok();
    }

}
